<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
		<title>评价</title>
		<%@include file="../common/rootPath.jsp" %>
		<link rel="stylesheet" type="text/css" href="${ctx}/css/reset.css" />
		<link rel="stylesheet" href="${ctx}/css/public.css" />
		<link rel="stylesheet" type="text/css" href="${ctx}/css/body.css" />
		
		<style type="text/css">
			.js_upFile {
			    width: 100%;
			    height: 19.0rem;
			    cursor: pointer;
			    position: absolute;
			    top: 0rem;
			    filter: alpha(opacity=0);
			    -moz-opacity: 0;
			    opacity: 0;
			}
		</style>
		
		<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
		<script type="text/javascript" src="${ctx}/js/jianrong.js"></script>
		<script type="text/javascript" src="${ctx}/js/fastclick.js"></script>
		<script type="text/JavaScript" src="${ctx}/js/jquery.form.js"></script> 
		<script type="text/javascript">
			/**提交评价*****/
			function submitEvaluate(){
				var goodsSatisfaction=0; //商品评分
				var logisticsScore = 0; // 物流评分
				var serviceScore = 0;  //服务评分
				var consultContent = $(".contentP").text();
				var goodsImg = "${ctx}/image/hx.png";
				$("#goodsEvaluateS li img").each(function () {
					if(goodsImg == $(this).attr("src")){
						goodsSatisfaction++;
					}
				});
				$(".logisticsScore li img").each(function(){
					if(goodsImg == $(this).attr("src")){
						logisticsScore++;
					}
				});
				$(".serviceScore li img").each(function(){
					if(goodsImg == $(this).attr("src")){
						serviceScore++;
					}
				})
				if(goodsSatisfaction==0){
					alert("商品评分不能为空")
					return false;
				}
				if(logisticsScore==0){
					alert("物流服务不能为空")
					return false;
				}
				if(serviceScore==0){
					alert("服务态度不能为空")
					return false;
				}
				if(consultContent==null || consultContent=="" || consultContent=="您对购买的商品还满意吗？说说它的优点和美中不足吧!"){
					alert("评价内容不能为空！！！")
					return false;
				}
				//alert("goodsSatisfaction:"+goodsSatisfaction+":logisticsScore:"+logisticsScore+":serviceScore:"+serviceScore)
				var goodsId = $("#goodsId").val();
				var goodsSkuInfo = $("#goodsSkuInfo").val();
				var orderId = $("#orderId").val();
				var filePicture = $("#filePicture").val();
				var filePicture2 = $("#filePicture2").val();
				var filePicture3 = $("#filePicture3").val();
				$.ajax({
					url : "${ctx}/consultComment/addCommont",
					type : "POST",
					data :{"goodsSatisfaction":goodsSatisfaction,"logisticsScore":logisticsScore,
						   "serviceScore":serviceScore,"goodsId":goodsId,"goodsSkuInfo":goodsSkuInfo,
							"orderId":orderId,"filePicture":filePicture,"filePicture2":filePicture2,
							"filePicture3":filePicture3,"consultContent":consultContent
					},
					success:function(data){
						if(data.resultSuccess == true){
							window.location.href='${ctx}/order/myOrders?queryStatus=4';
			    		 	//alert("评价商品成功")
			    		}else if(data.resultSuccess == false){
			    		    alert("评价商品失败")
			    		}
					},
					error : function(data, status, e){ 
				    	 alert("发表评价失败"+e);
				  	    // layer.msg('图片上传失败！',{offset: ['40%', '40%'],/*title: ['提醒', 'font-size:18px;'],*/icon:2,time:2000});
				      } 
				});
			}
		</script>
		
	</head>

	<body>
		<header>
			<nav class="headerTwo">
				<img src="${ctx}/image/bg.png" alt="" />
				<a href="javascript:history.back(-1)" class="fl"><img src="${ctx}/image/return.png" alt="" /></a>
				<h2>评价</h2>
				<a href="javascript:void(0);" onclick="submitEvaluate();" class="headerR"><span>发布</span></a>
			</nav>
		</header>
		
		
		
		<form action="" method="post" id="uploadImage" enctype="multipart/form-data">
			<input type="text" name="goodsId" id="goodsId" value="${products[0].productId}">
			<input type="text" name="goodsSkuInfo" id="goodsSkuInfo" value="${products[0].goods_sku_info}">
			<input type="text" name="orderId" id="orderId" value="${orderId}">
			<input type="text" name="filePicture" id="filePicture" value="">
			<input type="text" name="filePicture2" id="filePicture2" value="">
			<input type="text" name="filePicture3" id="filePicture3" value="">
			
		
			<div class="pay"></div>
			<div class="myevaluate">
				<c:choose>
					<c:when test="${products[0].picture!='' }">
						<img src="${products[0].picture}" alt="" />
					</c:when>
					<c:otherwise>
						<img src="${ctx}/image/pjpic88.png" alt="" />
					</c:otherwise>
				</c:choose>
				<span>商品评分</span>
				<ul class="myevaluateS" id="goodsEvaluateS">
					<li><img src="${ctx}/image/bx.png"  alt=""></li>
					<li><img src="${ctx}/image/bx.png"  alt=""></li>
					<li><img src="${ctx}/image/bx.png"  alt=""></li>
					<li><img src="${ctx}/image/bx.png"  alt=""></li>
					<li><img src="${ctx}/image/bx.png"  alt=""></li>
				</ul>
			</div>
			<div class="myevaluatecontent">
				<p contenteditable='true' class="contentP">您对购买的商品还满意吗？说说它的优点和美中不足吧!</p>
				<ul class="img-list">
					<li><img src="${ctx}/image/xj.png"  alt="" class="contentI"/></li>
				</ul>
				<div class="photo"> 
					<p>拍照</p> 
					<!-- <p><!-- <input id="fileImage"  class="fileImage" type="file"  multiple="multiple"  accept="image/*" capture="camera" size="30">  拍照</p> -->
					<!-- <input  type="file" name="files" id="filePath"  multiple="multiple" class="fileImage" accept="image/*" capture="camera" size="30">  -->
				    <!-- <input type="file" name="files" id="filePath"   multiple="multiple" accept="image/jpg,image/jpeg,image/png"  />   -->
					
					<input type="file" class="js_upFile" name="imageFiles" id="filePath" onchange="showImage();"  multiple="multiple" accept="image/*" capture="camera" size="30"> 
					<a id="upload"></a>
					<p class="moImage">从相册中选择</p>
					<p>取消</p>
				</div> 
			</div>
		</form>	
		<p class="jiange"></p>
		<div class="myevaluateM clearfix">
			<img src="${ctx}/image/yuan2.png" alt="" />
			<span>匿名评价</span>
			<span class="myevaluateMr fr">您写的评价将以匿名形式展现</span>
		</div>
		<p class="jiange"></p>
		<div class="myevaluateStore">
			<img src="${ctx}/image/dian.png" alt="" />
			<span>店铺评分</span>
		</div>
		<ul class="myevaluateS myevaluateO logisticsScore">
			<li>物流服务</li>
			<li><img src="${ctx}/image/bx.png" / alt=""></li>
			<li><img src="${ctx}/image/bx.png" / alt=""></li>
			<li><img src="${ctx}/image/bx.png" / alt=""></li>
			<li><img src="${ctx}/image/bx.png" / alt=""></li>
			<li><img src="${ctx}/image/bx.png" / alt=""></li>
		</ul>
		<ul class="myevaluateS myevaluateO serviceScore">
			<li>服务态度</li>
			<li><img src="${ctx}/image/bx.png" / alt=""></li>
			<li><img src="${ctx}/image/bx.png" / alt=""></li>
			<li><img src="${ctx}/image/bx.png" / alt=""></li>
			<li><img src="${ctx}/image/bx.png" / alt=""></li>
			<li><img src="${ctx}/image/bx.png" / alt=""></li>
		</ul>
		<div class="meng"></div>
		<%-- <script type="text/javascript" src="${ctx}/js/jquery.uploadView.js"></script> --%>
		<script type="text/javascript" src="${ctx}/js/public.js"></script>
		<%-- <script type="text/javascript" src="${ctx }/js/ajaxfileupload.js"></script> --%>
		<%-- <script type="text/javascript" src="${ctx }/js/order/uploadComment.js"></script>  --%>
		<%-- <script type="text/javascript" src="${ctx}/js/up_comment.js"></script>  --%>
		<script type="text/javascript" src="${ctx}/js/goods/up_comment.js"></script> 
	</body>
</html>